﻿@model A2.ERP.Models.t_User
@{
    A2.ERP.Models.t_User user = ViewBag.user;
    IEnumerable<A2.ERP.Models.t_Group> group = ViewBag.group;
}

<section id="EditUser">
    <div class="card">
        <div class="card-header">
            <i class="icon SkyUI icon-edit"></i>
            编辑用户
        </div>
        <div class="card-body">
            <form class="updateUserFrm" method="put" action="/setting/SysUserManager">
                <div class="form-group">
                    <label>用户名</label>
                    @Html.TextBoxFor(i => i.UserName, new { Value = user.UserName, @class = "form-control" })
                </div>
                <div class="form-group">
                    <label>真名</label>
                    @Html.TextBoxFor(i => i.RealName, new { Value = user.RealName, @class = "form-control" })
                </div>
                <div>
                    <label>

                    </label>
                </div>
                <div class="form-group">
                    <label>权限组管理</label>
                    @Html.DropDownList("GroupID", group.Select(i => new SelectListItem { Value = i.GroupID.ToString(), Text = i.GroupName }), new { @class = "form-control" })
                </div>
                <div class="form-group">
                    <label>地址</label>
                    @Html.TextBoxFor(i => i.Address, new { Value = user.Address, @class = "form-control" })
                </div>
                <div class="form-group">
                    <label>邮箱</label>
                    @Html.TextBoxFor(i => i.Email, new { Value = user.Email, @class = "form-control" })
                </div>
                <div class="form-group">
                    <label>旺旺</label>
                    @Html.TextBoxFor(i => i.WangWang, new { Value = user.WangWang, @class = "form-control" })
                </div>
                <div class="form-group">
                    <label>详情</label>
                    @Html.TextBoxFor(i => i.Description, new { Value = user.Description, @class = "form-control" })
                </div>
                <div class="form-group">
                    <label>状态</label>
                    @Html.DropDownList("State", new List<dynamic>() { new { value = "Y", name = "启用" }, new { value = "N", name = "禁用" } }.Select(i => new SelectListItem { Value = i.value, Text = i.name }), new { @class = "form-control" })
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary submit">修改</button>
                </div>
            </form>
        </div>
    </div>
</section>

<script>
    ;
    !function () {
        var $tabPage = $('#EditUser');
        var $form = $('#EditUser .updateUserFrm');

        $form.submit(function (e) {
            e.preventDefault();

            $form.ajaxSubmit({
                type: 'PUT',
                dataType: 'json',
                success: function (e) {
                    $tab.reloadTab('#SysUserManager');
                    $tab.close($tabPage);
                }
            });
        });
    }();
</script>